﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;

namespace UpdaterForm.Utils
{
     public class AppUtil
    {
         public static string GetCheckSumm(string InstallationPath)
         {
             var md5Array = new List<byte>();
             using (var md5 = MD5.Create())
             {
                 foreach (var file in FileUtil.ListAppFiles(InstallationPath))
                 {
                     using (var stream = File.OpenRead(file))
                     {
                         md5Array.AddRange(md5.ComputeHash(stream));
                     }
                 }

             }
            return Convert.ToBase64String(md5Array.ToArray()).GetHashCode().ToString();
         }
    }
}
